﻿package com.airnews.ticket.net;


/**
 * 后台接口实现
 * 
 */
public class NetAccessor {/*

	*//**
	 * 登录 保存登陆信息
	 * @param context
	 * @param logintype 登录方式 1：IMSI登录;2：用户名 + 密码登录
	 * @param loginaccount 登录帐号(手机号)
	 * @param loginpwd 登录密码
	 *//*
	public static void login(Context context, String logintype, String loginaccount, String loginpwd) {
		
		HashMap<String, String> params = new HashMap<String, String>();
		DataCache.currPhone.sessionkey = null;
		//账号登陆
		if(Constants.LOGIN_TYPE_ACCOUNT.equals(logintype)){
			DataCache.currPhone.imsi = loginaccount;
			params.put("loginaccount", loginaccount);
			params.put("loginpwd", loginpwd);
		}
		
		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "user.login");
		params.put("logintype", logintype);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));
		
		
		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(DataCache.currPhone, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject obj = jsonObject.optJSONObject("response");
					DataCache.currPhone.isLogin = obj.optString("isLogin");
					DataCache.currPhone.phone = obj.optString("phone");
					DataCache.currPhone.imsi = obj.optString("imsi");
					DataCache.currPhone.sessionkey = obj.optString("sessionkey");
					DataCache.currPhone.userName = obj.optString("userName");
					DataCache.currPhone.opendate = obj.optString("opendate");
					DataCache.currPhone.onlinetime = obj.optString("onlinetime");
				}
			}else{
				DataCache.currPhone.msg = context.getString(R.string.login_error);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	*//**
	 * 初始化公共参数
	 * 
	 * @param context
	 * @param params
	 *//*
	private static void initCommonParams(Context context,
			HashMap<String, String> params) {
		params.put("name", Constants.NAME);
		params.put("imsi", DataCache.currPhone.imsi);
		params.put("esn", DataCache.currPhone.esn);
		params.put("category", Constants.CATEGORY);
		params.put("termcode", Constants.TERMCODE);
		if (!TextUtils.isEmpty(DataCache.currPhone.sessionkey)) {
			params.put("sessionkey", DataCache.currPhone.sessionkey);
		}
		params.put("channel", Constants.CHANNEL);
		params.put("v", Constants.V);
		params.put("format", Constants.FORMAT);
	}

	*//**
	 * 登出
	 * 
	 * @param context
	 * @return
	 *//*
	public static BaseResult logout(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "user.logout");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		BaseResult baseResult = new BaseResult();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			BaseResult.parseBaseResult(baseResult, jsonObject);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return baseResult;
	}

	*//**
	 * 套餐查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<ServicePlan> queryRate(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bill.queryRate");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		CommonList<ServicePlan> commonList = new CommonList<ServicePlan>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject obj = jsonObject.optJSONObject("response");
					commonList.count = obj.optString("count");
					JSONArray items = obj.optJSONArray("item");
					for (int i = 0, len = items.length(); i < len; i++) {
						JSONObject item = items.optJSONObject(i);
						ServicePlan sp = new ServicePlan();
						sp.id = item.optString("id");
						sp.name = item.optString("name");
						sp.initValue = item.optInt("initValue");
						sp.spareValue = item.optInt("spareValue");
						sp.startDate = item.optString("startDate");
						sp.endDate = item.optString("endDate");
						sp.type = item.optString("type");
						commonList.items.add(sp);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	
	
	*//**
	 * 用户实时话费查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static Billnow queryBillnow(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bill.queryBillnow");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		Billnow billnow = new Billnow();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(billnow, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					if (response.has("feeWeek")) {
						JSONObject feeWeekObj = response.getJSONObject("feeWeek");
						FeeWeek feeWeek = new FeeWeek();
						feeWeek.id = feeWeekObj.optString("id");
						feeWeek.name = feeWeekObj.optString("name");
						feeWeek.type = feeWeekObj.optString("type");
						feeWeek.creditValue = feeWeekObj.optString("creditValue");
						feeWeek.spareValue = feeWeekObj.optDouble("spareValue");
						billnow.feeWeek = feeWeek;
					}
					if (response.has("telphoneFee")) {
						JSONObject telphoneFeeObj = response.getJSONObject("telphoneFee");
						TelphoneFee telphoneFee = new TelphoneFee();
						telphoneFee.longDisFee = telphoneFeeObj.optString("longDisFee");
						telphoneFee.localFee = telphoneFeeObj.optString("localFee");
						telphoneFee.otherFee = telphoneFeeObj.optString("otherFee");
						telphoneFee.amountFee = telphoneFeeObj.optString("amountFee");
						billnow.telphoneFee = telphoneFee;
					}
					if (response.has("runTimeArrear")) {
						JSONObject runTimeArrearObj = response.getJSONObject("runTimeArrear");
						RunTimeArrear runTimeArrear = new RunTimeArrear();
						runTimeArrear.currentArrearFee = runTimeArrearObj.optString("currentArrearFee");
						runTimeArrear.isOutputBill = runTimeArrearObj.optString("isOutputBill");
						runTimeArrear.freezeFee = runTimeArrearObj.optString("freezeFee");
						runTimeArrear.count = runTimeArrearObj.optString("count");
						JSONArray items = runTimeArrearObj.optJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject item = items.getJSONObject(i);
							runTimeArrearItem ditem = new runTimeArrearItem();
							ditem.type = item.optString("type");
							ditem.name = item.optString("name");
							ditem.value = item.optString("value");
							runTimeArrear.items.add(ditem);
						}
						billnow.runTimeArrear = runTimeArrear;
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return billnow;
	}

	*//**
	 * 用户欠费信息查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<Pay> queryUnPay(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bill.queryUnPay");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		CommonList<Pay> commonList = new CommonList<Pay>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					JSONArray items = response.optJSONArray("item");
					for (int i = 0, len = items.length(); i < len; i++) {
						JSONObject item = items.getJSONObject(i);
						Pay ditem = new Pay();
						ditem.number = item.optString("number");
						ditem.name = item.optString("name");
						ditem.useFee = item.optString("useFee");
						ditem.unPayFee = item.optString("unPayFee");
						commonList.items.add(ditem);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 用户余额查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<Balance> queryBalance(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bill.queryBalance");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		CommonList<Balance> commonList = new CommonList<Balance>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					JSONArray items = response.optJSONArray("item");
					for (int i = 0, len = items.length(); i < len; i++) {
						JSONObject item = items.getJSONObject(i);
						Balance ditem = new Balance();
						ditem.number = item.optString("number");
						ditem.preconcertBalance = item
								.optString("preconcertBalance");
						ditem.presentBalance = item.optString("presentBalance");
						commonList.items.add(ditem);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 用户账单查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static Bill queryBill(Context context, String month) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bill.queryBill");
		params.put("month", month);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+month));

		Bill bill = new Bill();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(bill, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					
					JSONArray suiteArr = response.optJSONArray("suite");
					if(suiteArr.length()>0)
					{
						JSONObject suiteObj = suiteArr.getJSONObject(0);
						if (suiteObj != null) {
							Suite suite = new Suite();
							suite.number = suiteObj.optString("number");
							suite.amount = Utils.fenToYuan(suiteObj.optInt("amount"));
							suite.count = suiteObj.optString("count");
	
							JSONArray items = suiteObj.optJSONArray("suiteItem");
							for (int i = 0, len = items.length(); i < len; i++) {
								JSONObject item = items.getJSONObject(i);
								SuiteItem ditem = new SuiteItem();
								ditem.number = item.optString("number");
								ditem.terminal = item.optString("terminal");
								ditem.isValid = item.optBoolean("isValid");
								ditem.itemCode = item.optString("itemCode");
								ditem.itemName = item.optString("itemName");
								ditem.money = Utils.fenToYuan(item.optInt("money"));
								ditem.billType = item.optString("billType");
								ditem.billPrint = item.optString("billPrint");
								suite.suiteItems.add(ditem);
							}
							bill.suite = suite;
						}
					}

					JSONObject billSumObj = response.optJSONObject("billSum");
					if (billSumObj != null) {
						BillSum billSum = new BillSum();
						billSum.amount = Utils.fenToYuan(billSumObj.optInt("amount"));
						billSum.fee = Utils.fenToYuan(billSumObj.optInt("fee"));
						billSum.preconcertPay = billSumObj
								.optString("preconcertPay");
						billSum.pay = Utils.fenToYuan(billSumObj.optInt("pay"));
						billSum.terminalCount = billSumObj
								.optString("terminalCount");
						bill.billSum = billSum;
					}
					
					JSONArray otherArr = response.optJSONArray("other");
					if(otherArr.length()>0)
					{
						JSONObject otherObj = otherArr.getJSONObject(0);
						if (otherObj != null) {
							OtherBill otherBill = new OtherBill();
							otherBill.number = otherObj.optString("number");
							otherBill.amount = Utils.fenToYuan(otherObj.optInt("amount"));
							otherBill.count = otherObj.optString("count");
	
							JSONArray items = otherObj.optJSONArray("otherItem");
							for (int i = 0, len = items.length(); i < len; i++) {
								JSONObject item = items.getJSONObject(i);
								SuiteItem ditem = new SuiteItem();
								ditem.number = item.optString("number");
								ditem.terminal = item.optString("terminal");
								ditem.isValid = item.optBoolean("isValid");
								ditem.itemCode = item.optString("itemCode");
								ditem.itemName = item.optString("itemName");
								ditem.money = Utils.fenToYuan(item.optInt("money"));
								ditem.billType = item.optString("billType");
								ditem.billPrint = item.optString("billPrint");
								otherBill.otherItems.add(ditem);
							}
							bill.other = otherBill;
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bill;
	}

	*//**
	 * 缴费记录查询
	 * 
	 * @param context
	 * @param beginDate
	 * @param endDate
	 * @return
	 *//*
	public static CommonList<PayRecord> queryPayRecord(Context context,
			String beginDate, String endDate) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bill.queryPayRecord");
		params.put("beginDate", beginDate);
		params.put("endDate", endDate);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+beginDate+endDate));

		CommonList<PayRecord> commonList = new CommonList<PayRecord>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					JSONArray items = response.optJSONArray("item");
					for (int i = 0, len = items.length(); i < len; i++) {
						JSONObject item = items.getJSONObject(i);
						PayRecord ditem = new PayRecord();
						ditem.number = item.optString("number");
						ditem.bargainNo = item.optString("bargainNo");
						ditem.provider = item.optString("provider");
						ditem.payWeek = item.optString("payWeek");
						ditem.amount = Utils.fenToYuan(item.optInt("amount"));
						ditem.lateFee = Utils.fenToYuan(item.optInt("lateFee"));
						ditem.payType = item.optString("payType");
						ditem.payDate = item.optString("payDate");
						commonList.items.add(ditem);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 已订业务查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<OrderService> queryOrderService(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bill.queryOrderService");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		CommonList<OrderService> commonList = new CommonList<OrderService>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					if (response.has("item")) {
						JSONArray items = response.getJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject item = items.getJSONObject(i);
							OrderService ditem = new OrderService();
							ditem.id = item.optString("id");
							ditem.code = item.optString("code");
							ditem.name = item.optString("name");
							ditem.desc = item.optString("desc");
							ditem.chargeInfo = item.optString("chargeInfo");
							ditem.spName = item.optString("spName");
							ditem.subscribeTime = item.optString("subscribeTime");
							ditem.effectiveTime = item.optString("effectiveTime");
							ditem.expireTime = item.optString("expireTime");
							ditem.orderNumber = item.optString("orderNumber");
							ditem.useNumber = item.optString("useNumber");
							ditem.feeNumber = item.optString("feeNumber");
							commonList.items.add(ditem);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 积分查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static Integral queryIntegral(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "leaguer.queryIntegral");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		Integral integral = new Integral();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(integral, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					if (response.has("integralSum")) {
						JSONObject integralSumObj = response.getJSONObject("integralSum");
						IntegralSum integralSum = new IntegralSum();
						integralSum.amount = integralSumObj.optInt("amount");
						integralSum.use = integralSumObj.optInt("use");
						integralSum.spare = integralSumObj.optInt("spare");
						integral.integralSum = integralSum;
					}
					if (response.has("integralDetail")) {
						JSONObject integralDetailObj = response.getJSONObject("integralDetail");
						CommonList<IntegralDetail> integralDetail = new CommonList<IntegralDetail>();
						integralDetail.count = integralDetailObj.optString("count");
						JSONArray items = integralDetailObj.optJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject item = items.getJSONObject(i);
							IntegralDetail ditem = new IntegralDetail();
							ditem.integralWeek = item.optString("integralWeek");
							ditem.amountIntegral = item.optString("amountIntegral");
							ditem.feeIntegral = item.optString("feeIntegral");
							ditem.presentIntegral = item.optString("presentIntegral");
							ditem.canUseIntegral = item.optString("canUseIntegral");
							ditem.usedIntegral = item.optString("usedIntegral");
							integralDetail.items.add(ditem);
						}
						integral.integralDetail = integralDetail;
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return integral;
	}

	*//**
	 * 我参加的优惠查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<ComboInfo> queryComboInfo(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "leaguer.queryComboInfo");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		CommonList<ComboInfo> commonList = new CommonList<ComboInfo>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					if (response.has("item")) {
						JSONArray items = response.optJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject itemObj = items.getJSONObject(i);
							ComboInfo comboInfo = new ComboInfo();
							comboInfo.name = itemObj.optString("name");
							String startDate = itemObj.optString("startDate");
							if(!TextUtils.isEmpty(startDate)){
								startDate = startDate.substring(0, 8);
								 comboInfo.startDate = 
									 DateUtil.convertDateStringFormat(startDate, "yyyyMMdd", "yyyy-MM-dd");
							}
							String endDate = itemObj.optString("endDate");
							if(!TextUtils.isEmpty(endDate)){
								endDate = endDate.substring(0, 8);
								comboInfo.endDate = 
									DateUtil.convertDateStringFormat(endDate, "yyyyMMdd", "yyyy-MM-dd");
							}
							commonList.items.add(comboInfo);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 充值卡充值
	 * 
	 * @param context
	 * @param cardpin 充值卡密码
	 * @param number 充值号码
	 * @return
	 *//*
	public static Sequence payByCard(Context context, String cardpin, 
			String number) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "pay.payByCard");
		String DES_KEY = DataCache.currPhone.imsi 
			+ params.get("timestamp") + Constants.PASSWORD;
		cardpin = DESedeUtil.encrypt(DES_KEY, cardpin);
		params.put("cardpin", cardpin);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+cardpin));
		if(!TextUtils.isEmpty(number)){
			params.put("number", number);
		}

		Sequence sequence = new Sequence();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(sequence, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					sequence.sequence = response.optString("sequence");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sequence;
	}

	*//**
	 * 充值记录查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<RechargeRcd> queryExchange(Context context, String beginDate, String endDate) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "pay.queryRecharge");
		params.put("beginDate", beginDate);
		params.put("endDate", endDate);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+beginDate+endDate));
		

		CommonList<RechargeRcd> commonList = new CommonList<RechargeRcd>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					if (response.has("item")) {
						JSONArray items = response.getJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject item = items.getJSONObject(i);
							RechargeRcd exchange = new RechargeRcd();
							exchange.chargeTime = item.optString("chargeTime");
							exchange.cardNo = item.optString("cardNo");
							exchange.number = item.optString("number");
							exchange.name = item.optString("name");
							exchange.fee = item.optString("fee");
							commonList.items.add(exchange);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 充值卡状态查询
	 * 
	 * @param context
	 * @param cardno
	 * @return
	 *//*
	public static CardStatus queryCardStatus(Context context, String cardno) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "pay.queryCardStatus");
		params.put("cardno", cardno);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+cardno));

		CardStatus cardStatus = new CardStatus();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(cardStatus, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					cardStatus.cardID = response.optString("cardID");
					cardStatus.cardAmount = response.optString("cardAmount");
					cardStatus.cardBatchNo = response.optString("cardBatchNo");
					cardStatus.cardExpDate = response.optString("cardExpDate");
					cardStatus.cardState = response.optString("cardState");
					cardStatus.cardType = response.optString("cardType");
					cardStatus.callingNumber = response
							.optString("callingNumber");
					cardStatus.rechargeTime = response
							.optString("rechargeTime");
					cardStatus.destinationAccount = response
							.optString("destinationAccount");
					cardStatus.destinationAttr = response
							.optString("destinationAttr");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return cardStatus;
	}

	*//**
	 * 推荐业务信息查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<Business> queryRecommend(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "operation.queryRecommend");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		CommonList<Business> recommendList = new CommonList<Business>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(recommendList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					recommendList.count = response.optString("count");
					parseBusinessList(recommendList, response);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return recommendList;
	}

	
	
	*//**
	 * 解析业务列表
	 * @param recommendList
	 * @param response
	 * @throws JSONException
	 *//*
	private static void parseBusinessList(CommonList<Business> businessList, JSONObject response) 
			throws JSONException {
		if (response.has("item")) {
			JSONArray items = response.optJSONArray("item");
			for (int i = 0, len = items.length(); i < len; i++) {
				JSONObject item = items.optJSONObject(i);
				Business biz = new Business();
				biz.name = item.optString("name");
				biz.desc = item.optString("desc");
				biz.pic = item.optString("pic");
				biz.runActive = item.optString("runActive");
				biz.code = item.optString("code");
				if (item.has("subItem")) {
					JSONArray subItems = item.getJSONArray("subItem");
					for (int j = 0, l = subItems.length(); j < l; j++) {
						JSONObject subItem = subItems.optJSONObject(i);
						Business subBiz = new Business();
						subBiz.name = subItem.optString("name");
						subBiz.desc = subItem.optString("desc");
						subBiz.pic = subItem.optString("pic");
						subBiz.runActive = subItem.optString("runActive");
						subBiz.code = subItem.optString("code");
						biz.subItems.add(subBiz);
					}
				}
				businessList.items.add(biz);
			}
		}
	}
	
	
	
	*//**
	 * 最新业务信息查询
	 * @param context
	 * @return
	 *//*
	public static CommonList<Business> queryNewBus(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "operation.queryNewBus");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		CommonList<Business> recommendList = new CommonList<Business>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(recommendList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					recommendList.count = response.optString("count");
					parseBusinessList(recommendList, response);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return recommendList;
	}
	
	
	
	*//**
	 * 业务详细信息查询
	 * @param context
	 * @param code 业务编码
	 * @return
	 *//*
	public static Business queryBusDetail(Context context, String code) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "operation.queryBusDetail");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+code));
		params.put("code", code);

		Business business = new Business();
		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(business, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					business.name = response.optString("name");
					business.desc = response.optString("desc");
					business.pic = response.optString("pic");
					business.runActive = response.optString("runActive");
					business.code = response.optString("code");
					business.usedesc = response.optString("usedesc");
					business.proper = response.optString("proper");
					business.fee = response.optString("fee");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return business;
	}
	
	
	
	*//**
	 * 业务开通与取消
	 * @param context
	 * @param code 业务编码
	 * @param optype 操作类型 1-开通 2-取消
	 * @return
	 *//*
	public static Sequence openAndCloseBus(Context context, String code, String optype) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "operation.openAndCloseBus");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+code+optype));
		
		params.put("code", code);
		params.put("optype", optype);

		Sequence sequence = new Sequence();
		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(sequence, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					sequence.sequence = response.optString("sequence");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sequence;
	}
	
	
	
	*//**
	 * 业务办理纪录查询
	 * @param context
	 * @param beginDate
	 * @param endDate
	 * @return
	 *//*
	public static CommonList<BusRecord> queryBusRecord(Context context, String beginDate, String endDate) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "operation.queryBusRecord");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+beginDate+endDate));
		
		params.put("beginDate", beginDate);
		params.put("endDate", endDate);

		CommonList<BusRecord> busRecordList = new CommonList<BusRecord>();
		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(busRecordList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					busRecordList.count = response.optString("count");
					if(response.has("item")){
						JSONArray items = response.optJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject item = items.getJSONObject(i);
							BusRecord ditem = new BusRecord();
							ditem.orderNo = item.optString("orderNo");
							ditem.name = item.optString("name");
							ditem.phone = item.optString("phone");
							ditem.status = item.optString("status");
							ditem.content = item.optString("content");
							ditem.time = item.optString("time");
							busRecordList.items.add(ditem);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return busRecordList;
	}
	

	*//**
	 * WAP门户信息查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<Wap> queryWap(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "operation.queryWap");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));
		
		CommonList<Wap> commonList = new CommonList<Wap>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					if (response.has("item")) {
						JSONArray items = response.getJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject item = items.getJSONObject(i);
							Wap wap = new Wap();
							wap.name = item.optString("name");
							wap.desc = item.optString("desc");
							wap.pic = item.optString("pic");
							wap.url = item.optString("url");
							if(!TextUtils.isEmpty(wap.pic)){
								wap.iconBm = HttpUtils.getBitmapFromUrl(context, wap.pic);
							}
							commonList.items.add(wap);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 用户密码修改
	 * 
	 * @param context
	 * @param oldpwd
	 * @param newpwd
	 * @return
	 *//*
	public static Sequence changePwd(Context context, String oldpwd,
			String newpwd) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.changePwd");
		params.put("oldpwd", oldpwd);
		params.put("newpwd", newpwd);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+oldpwd+newpwd));

		Sequence sequence = new Sequence();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(sequence, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					sequence.sequence = response.optString("serialNo");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sequence;
	}
	
	
	*//**
	 * 实现呼叫转移业务的开通和取消
	 * @param context
	 * @param optype 1. 开通; 2. 取消
	 * @return
	 *//*
	public static Sequence callTransfer(Context context, String optype) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.callTransfer");
		params.put("optype", optype);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+optype));

		Sequence sequence = new Sequence();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(sequence, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					sequence.sequence = response.optString("sequence");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sequence;
	}
	
	
	*//**
	 * 呼叫转移状态查询
	 * @param context
	 * @return
	 *//*
	public static Sequence queryCallTransferStatus(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.queryCallTransferStatus");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		Sequence sequence = new Sequence();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(sequence, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					sequence.sequence = response.optString("status");//1. 开通 2. 取消
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sequence;
	}
	

	*//**
	 * PUK码查询
	 * 
	 * @param context
	 * @return
	 *//*
	public static CommonList<String> queryPuk(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.queryPuk");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));
		
		CommonList<String> commonList = new CommonList<String>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(commonList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					commonList.count = response.optString("count");
					if (response.has("item")) {
						JSONArray items = response.getJSONArray("item");
						for (int i = 0, len = items.length(); i < len; i++) {
							JSONObject item = items.getJSONObject(i);
							String code = item.optString("code");
							commonList.items.add(code);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return commonList;
	}

	*//**
	 * 号码归属地查询
	 * 
	 * @param context
	 * @param number
	 * @return
	 *//*
	public static NumArea queryNumArea(Context context, String number) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.queryNumArea");
		params.put("number", number);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+number));
		
		NumArea numArea = new NumArea();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(numArea, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					numArea.province = response.optString("province");
					numArea.city = response.optString("city");
					numArea.area = response.optString("area");
					numArea.code = response.optString("code");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return numArea;
	}

	*//**
	 * 区号查询
	 * 
	 * @param context
	 * @param code
	 *            区号
	 * @return
	 *//*
	public static NumArea queryArea(Context context, String code) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.queryArea");
		params.put("code", code);
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp+code));

		NumArea numArea = new NumArea();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL,
					params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(numArea, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					numArea.province = response.optString("province");
					numArea.city = response.optString("city");
					numArea.area = response.optString("area");
					numArea.code = response.optString("code");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return numArea;
	}

	*//**
	 * 检查升级
	 * 
	 * @param context
	 * @return
	 *//*
	public static VersionInfo getSoftVersion(Context context) {
		try {
			String urlString = Constants.APP_DOWNLOAD_URL + "softVersionServlet.htm";// 生产 http://tianyi.189lab.com/ifservice/
			HashMap<String, String> params = new HashMap<String, String>();
			params.put("imsi", PhoneUtils.getImsi(context));
			params.put("esm", PhoneUtils.getEsn(context));
			params.put("classid", Constants.CLASS_ID);
			params.put("method", "updateSoftVersion");
			params.put("category", "android");
			params.put("phone", PhoneUtils.getModel());

			String jsonString = HttpUtils.doPost(context, urlString, params);
			if (!TextUtils.isEmpty(jsonString)) {
				VersionInfo info = new VersionInfo();
				JSONObject jsonObject = new JSONObject(jsonString);
				info.isoptional = jsonObject.optString("isoptional");
				info.path = jsonObject.optString("path");
				info.version = jsonObject.optString("version");
				return info;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	
	*//**
	 * 获取应用列表
	 * @param context
	 *//*
	public static AppInfoList getAppList(Context context){
		String url = Constants.APP_DOWNLOAD_URL+"pluginListServlet.htm";
		HashMap<String,String> map = new HashMap<String,String>();
		map.put("method", "getPluginList");
		map.put("category", "android");
		map.put("classid", Constants.CLASS_ID);
		map.put("page", "1");
		map.put("pagesize", "20");
		map.put("imsi", PhoneUtils.getImsi(context));
		map.put("esn", PhoneUtils.getEsn(context));
		map.put("phone", PhoneUtils.getModel());
		String jsonString = null;
		AppInfoList appInfoList = null;
		try {
			jsonString = HttpUtils.doPost(context, url, map);
			JSONObject jsonObject = new JSONObject(jsonString);
			appInfoList = new AppInfoList();
			//appInfoList = jsonObject.optString("errorcode");
			
			appInfoList.resultcount = jsonObject.optInt("resultcount");
			appInfoList.curpage = jsonObject.optInt("curpage");
			appInfoList.totalpage = jsonObject.optInt("totalpage");
			//pageNums = (int) Math.ceil(appInfoList.resultcount / Constants.PAGE_SIZE);
			if(jsonObject.has("resultlist")){
				JSONArray resultlistObj = jsonObject.optJSONArray("resultlist");
				for (int i = 0, len = resultlistObj.length(); i < len; i++) {
					JSONObject json = resultlistObj.optJSONObject(i);
					AppInfo appInfo = new AppInfo();
					appInfo.iconfile = json.optString("iconfile");
					appInfo.level = json.optString("level");
					appInfo.appname = json.optString("appname");
					appInfo.pushmsg = json.optString("pushmsg");
					appInfo.price = json.optString("price");
					appInfo.apptitle = json.optString("apptitle");
					appInfo.clasid = json.optString("clasid");
					appInfo.path = json.optString("path");
					appInfo.isoptional = json.optString("isoptional");
					appInfo.introduction = json.optString("introduction");
					appInfo.version = json.optString("version");
					appInfoList.resultlist.add(appInfo);
				}
			}
			//获取应用图标
			String iconpath = jsonObject.optString("iconpath");
			appInfoList.picFileMap = FileUtils.Decompresses(iconpath, context);
			for(int i=0, len = appInfoList.resultlist.size(); i < len; i++){
				AppInfo appInfo = appInfoList.resultlist.get(i);
				File file  = appInfoList.picFileMap.get(appInfo.iconfile);
				if(file != null){
					appInfo.iconfilePath = file.getPath();
				}
			}
		}catch (Exception e) {
			e.printStackTrace();
		}
		return appInfoList;
	}

	
	
	*//**
	 * 营业厅的城市查询
	 * @param context
	 * @param code
	 * @return
	 *//*
	public static NodeCity queryNodeCity(Context context) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.queryNodeCity");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("sig", Utils.getSig(context, timestamp));

		NodeCity nodeCity = new NodeCity();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(nodeCity, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					nodeCity.defaultcity = response.optString("defaultcity");
					nodeCity.defaultcode = response.optString("defaultcode");
					nodeCity.cityList.count = response.optString("count");
					if(response.has("item")){
						JSONArray items = response.optJSONArray("item");
						for(int i=0, len = items.length(); i < len; i++){
							JSONObject item = items.getJSONObject(i);
							City city = new City();
							city.city = item.optString("city");
							city.citycode = item.optString("citycode");
							nodeCity.cityList.items.add(city);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return nodeCity;
	}
	
	
	*//**
	 * 查询某市有营业厅的地区
	 * @param context
	 * @param citycode
	 * @return
	 *//*
	public static CommonList<Area> queryNodeArea(Context context, String citycode) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.queryNodeArea");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("citycode", citycode);
		params.put("sig", Utils.getSig(context, timestamp + citycode));

		CommonList<Area> areaList = new CommonList<Area>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(areaList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					areaList.count = response.optString("count");
					if(response.has("item")){
						JSONArray items = response.optJSONArray("item");
						for(int i=0, len = items.length(); i < len; i++){
							JSONObject item = items.getJSONObject(i);
							Area area = new Area();
							area.areaname = item.optString("areaname");
							area.areacode = item.optString("areacode");
							areaList.items.add(area);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return areaList;
	}
	
	
	*//**
	 * 营业厅位置列表查询(支持模糊查询)
	 * @param context
	 * @param citycode
	 * @param areacode
	 * @param keys
	 * @return
	 *//*
	public static CommonList<BizHallInfo> queryNodeInfoList(Context context, String citycode, 
			String areacode, String keys) {

		HashMap<String, String> params = new HashMap<String, String>();

		// 公共参数
		initCommonParams(context, params);

		// 业务参数
		params.put("method", "bardian.queryNodeInfoList");
		String timestamp = System.currentTimeMillis() + "";
		params.put("timestamp", timestamp);
		params.put("citycode", citycode);
		params.put("areacode", areacode);
		params.put("keys", keys);
		params.put("sig", Utils.getSig(context, timestamp + citycode + areacode + keys));

		CommonList<BizHallInfo> bizHallList = new CommonList<BizHallInfo>();

		try {
			String jsonResult = HttpUtils.doPost(context, Constants.BASE_URL, params);
			JSONObject jsonObject = new JSONObject(jsonResult);
			if (BaseResult.parseBaseResult(bizHallList, jsonObject)) {
				if (jsonObject.has("response")) {
					JSONObject response = jsonObject.optJSONObject("response");
					bizHallList.count = response.optString("count");
					if(response.has("item")){
						JSONArray items = response.optJSONArray("item");
						for(int i=0, len = items.length(); i < len; i++){
							JSONObject item = items.getJSONObject(i);
							BizHallInfo bizHallInfo = new BizHallInfo();
							bizHallInfo.citycode= item.optString("citycode");
							bizHallInfo.areacode= item.optString("areacode");
							bizHallInfo.nodename= item.optString("nodename");
							bizHallInfo.address= item.optString("address");
							bizHallInfo.opentime= item.optString("opentime");
							bizHallInfo.range= item.optString("range");
							bizHallInfo.phone= item.optString("phone");
							bizHallList.items.add(bizHallInfo);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bizHallList;
	}
	
*/}
